from threading import Thread, Lock
from time import sleep

lk = Lock()

a = 0
b = 1


def value():
    while True:
        #lk.acquire()
        if a != b:
            print("a=%d,b=%d" % (a, b))
        #lk.release()


t = Thread(target=value)
t.start()

while True:
    #lk.acquire()
    a += 1
    #sleep(0.001)
    b += 1
    #lk.release()
